﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XWord.Fundamental.Domain;
using NHibernateUnitOfWork;
using System.IO;
using Iesi.Collections.Generic;

namespace ConsoleApplication1
{
   public class LCConversationTest
    {
       public static void Test1()
       {
           TextReader reader = new StreamReader("D:\\test.txt", Encoding.Default);
          
          

           List<Question> list = new List<Question>();
           for (int i = 11; i < 36; i++)
           {
               Question qustion = new Question();
               
             
               qustion.Sentence = string.Empty;
               qustion.Priority = i;
               qustion.CreateTime = new DateTime(2007, 6, 22);
               qustion.Choices = new HashedSet<Choice>();
               for (int j = 0; j < 4; j++)
               {
                   Choice choice = new Choice();
                   choice.Priority = j;
                   
                   string choiceStr = reader.ReadLine().Trim();
                   if (!string.IsNullOrEmpty(choiceStr))
                   {
                       choiceStr = choiceStr.Substring(choiceStr.IndexOf("）") + 1).Trim();
                       choice.Sentence = choiceStr;
                       UnitOfWork.CurrentSession.Persist(choice);
                       qustion.Choices.Add(choice);
                   }
               }
               list.Add(qustion);
               UnitOfWork.CurrentSession.Save(qustion);
               UnitOfWork.CurrentSession.Flush();
               // list.Add(qustion);
           }
           //  art.Questions.Clear();
          
       }
    }
}
